#pragma once

#include "../UserRegionDef.h"
#include "../../Target/targetbase.hpp"

class AlarmInfoWidget;
class MainMap;

using namespace rsws;

class RegionDetector
{
public:
    RegionDetector();
    ~RegionDetector();

    void setAlarmWidget(AlarmInfoWidget *widget, MainMap *mapInstance);

    void realDetect(GeoRegion *region, all_target_info_base*target, std::list<location_info>* target_history);

private:
    void generateAlarm(GeoRegion *region, all_target_info_base*target, int status);
    void paramDetect(GeoRegion *region, all_target_info_base*target);

    void setAlarmStatusMask(uint32_t& mask, uint32_t maskBit);
    void clearAlarmStatusMask(uint32_t& mask, uint32_t maskBit);

    void setStatus(GeoRegion *region, all_target_info_base*target, bool isAlarm, int mask);

    bool isDetectAlarmType(GeoRegion *region, int mask);
private:
    AlarmInfoWidget *alarm_info_widget_;
    MainMap *map_instance_;
};